package cn.hairui.blog.repository;

import cn.hairui.blog.mapper.TabMenuMapper;
import cn.hairui.blog.model.TabMenu;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @author lihairui
 * @version V1.0
 * @date: 2019/7/28 19:43
 */
@Repository
public class TabMenuRepository {

    @Autowired
    private TabMenuMapper tabMenuMapper;

    public List<TabMenu> list() {
        return tabMenuMapper.list();
    }

    public List<Map> listMgr() {
        return tabMenuMapper.listMgr();
    }

    public void updateShowFlag(int id, String flag) {
        tabMenuMapper.updateShowFlag(id, flag);
    }

    public TabMenu find(int pk) {
        return tabMenuMapper.find(pk);
    }

    public List<TabMenu> listShow() {
        return tabMenuMapper.listShow();
    }

    public int add(TabMenu tabMenu) {
        tabMenuMapper.insert(tabMenu);
        return tabMenu.getId();
    }

    public int delete(int id) {
        return tabMenuMapper.deletebyPk(id);
    }

    public int update(TabMenu tabMenu) {
        return tabMenuMapper.update(tabMenu);
    }
}
